#ifndef INTERFACE_H
#define INTERFACE_H

#define NO_SCREEN
#define MAX_SCREEN_COUNT 4

#include <string>
#include <list>
using namespace std;

class Interface; //main class, handling all inputs and outputs (Input and Action types) by communication with Python
class Widget; //parent for all objects on the screen
class Widget_unit; //a single character on the screen, used to represent units
class Widget_building; //a 3x3 block on the screen, used to represent buildings
class Event; //the most general class of Interface inputs
class Input; //user input
class Input_key; //input from keyboard
class Input_click; //input of mouse click
class Input_wheel; //input made by turning the mouse wheel
class Action; //actions received from the net and pre-processed by the Game module
class Action_update; //action to update unit's properties
class Action_add; //action to add a unit or a building
class Action_delete; //action to delete a unit or a building
class Action_chat; //received action from chat
class Action_system; //system info about game state
class Action_effect; //visualisation (ie. shooting)
class Command; //command sent by the Interface to the Game
class Command_unit;
class Command_building;
class Command_system;
class Command_chat;
enum Widget_owner{WID_SELF, WID_ALLY, WID_ENEMY, WID_NEUTRAL}; //owner of Widgets UNIT or BUILDING
enum Widget_type{WID_UNIT, WID_BUILDING, WID_FRAME, WID_MENU, WID_MENU_ITEM, WID_MSGBOX, WID_STATUSBAR}; //type of a Widget
enum Event_type{INP_KEY, INP_CLICK, INP_WHEEL, ACT_UPDATE, ACT_ADD, ACT_DELETE, ACT_CHAT, ACT_SYSTEM, ACT_EFFECT}; //all possible types of Events
//: key, mouse click, wheel scroll, alter unit, add unit/building, delete unit/building, chat message, gamestate, visualisation
enum Wheel_direction{WHE_UP, WHE_DOWN}; //direction of scrolling with the mouse wheel (used in Input_wheel)

#include "includes.h"

class Interface{
	private:
		list<string> shell_parameters;
		Python* python;
		Game* game;
		Screen* screens[MAX_SCREEN_COUNT];
	public:
		list <Command*> handle(Input* input);
		void handle(Action* action);
		void blit();
		bool add_screen(Screen* screen);
		Interface();
		Interface(int argc, char* argv[]);
		~Interface();
};

class Widget{
	public:
		enum Widget_type type;
		int id;
		int x, y;
		void move_to(int ix, int iy);
		Widget();
 		~Widget();
};

class Widget_unit:public Widget{
	public:
		char name;
		enum Widget_owner owner;
		Widget_unit();
		Widget_unit(char iname);
		Widget_unit(char iname, int ix, int iy);
};

class Widget_building:public Widget{
	public:
		string name;
		enum Widget_owner owner;
		Widget_building();
		Widget_building(string iname);
};

class Event{
	public:
		enum Event_type type;
		long time;
};

class Input: public Event{
	public:
		bool ctrl, alt, shift;
};

class Input_key: public Input{
	public:
		int key;
		Input_key(int ikey, bool ictrl, bool ialt, bool ishift);
};

class Input_click: public Input{
	public:
		int x, y;
};

class Input_wheel: public Input{
	public:
		enum Wheel_direction direction;
};
class Action: public Event{
	public:
};
class Action_update:public Action{
	public:
		Unit* unit;
		long x, y;
		Action_update(int unit_id, long x, long y);
};
class Action_add:public Action{
	public:
		Unit* unit;
		Action_add();
};
class Action_delete:public Action{
	public:
		Unit* unit;
};
class Action_chat:public Action{
	public:
		Player* sender;
		string text;
};
class Action_system:public Action{
	public:
		int event;
};
class Action_effect:public Action{
	public:
		int effect_type;
		long int x;
		long int y;
};
class Command{
	public:
};
class Command_unit: public Command{
	public:
		Unit* unit;
};
class Command_building: public Command{
	public:
		Building* building;
};
class Command_system: public Command{
	public:
		int event;
};
class Command_chat: public Command{
	public:
		list <Player*> receivers;
		string text;
};

#endif
